/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.tramite.be;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.cip.esymons.general.be.Solicitante;

/**
 *
 * @author FreddyHIQ
 */
@Entity
@Table(name = "tra_sol_recep")
@NamedQueries({@NamedQuery(name = "SolRecep.findAll", query = "SELECT s FROM SolRecep s"), @NamedQuery(name = "SolRecep.findBySreTransac", query = "SELECT s FROM SolRecep s WHERE s.sreTransac = :sreTransac")})
public class SolRecep implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "sre_transac")
    private Long sreTransac;
    @JoinColumn(name = "sre_solicit", referencedColumnName = "sol_codigo")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Solicitante sreSolicit;
    @JoinColumn(name = "sre_transac", referencedColumnName = "tra_codigo", insertable = false, updatable = false)
    @OneToOne(optional = false, fetch = FetchType.LAZY)
    private Transaccion transaccion;

    public SolRecep() {
    }

    public SolRecep(Long sreTransac) {
        this.sreTransac = sreTransac;
    }

    public SolRecep(Long sreTransac, Solicitante sol) {
        this.sreTransac = sreTransac;
        this.sreSolicit = sol;
    }

    public Long getSreTransac() {
        return sreTransac;
    }

    public void setSreTransac(Long sreTransac) {
        this.sreTransac = sreTransac;
    }

    public Solicitante getSreSolicit() {
        return sreSolicit;
    }

    public void setSreSolicit(Solicitante sreSolicit) {
        this.sreSolicit = sreSolicit;
    }

    public Transaccion getTransaccion() {
        return transaccion;
    }

    public void setTransaccion(Transaccion transaccion) {
        this.transaccion = transaccion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sreTransac != null ? sreTransac.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SolRecep)) {
            return false;
        }
        SolRecep other = (SolRecep) object;
        if ((this.sreTransac == null && other.sreTransac != null) || (this.sreTransac != null && !this.sreTransac.equals(other.sreTransac))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.tramite.be.SolRecep[sreTransac=" + sreTransac + "]";
    }

}
